import java.util.Stack;

/*
 * 1. operates on any primitive function
 * 2. sends any name as an object on the run stack 
 */

public class RulePushY {
	
	Stack<ControlElement> control ;
	Stack<String> stack ;
	Environment environment;
	
	public RulePushY(Stack<ControlElement> control, Stack<String> stack, Environment environment){
		this.control = control;
		this.stack = stack;
		this.environment = environment;
	}
	
	/*
	 * if the control is an <identifier> than only it goes for a lookup
	 * else it just passes down to stack
	 * 1. pop rstar
	 * 2. push Y
	 */
	void applyRule() {
		control.pop();
		stack.push("Y");
	}

	boolean checkRule() {
		String controlTop = control.peek().content;
		if (controlTop.equals("<Y*>")) {
			return true;

		} else {
			return false;
		}
	}

}
